<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Dotnet2-web 后台管理系统</title>
<!--[if lt IE 9]>
<script src="js/html5.js"></script>
<![endif]-->
<%@ include file="/jsp/common/commonJs.jsp"%>
</head>
<body>
<!--header-->
<%@ include file="/jsp/top.jsp"%>
<!--header-->
<!--aside nav-->
<%@ include file="/jsp/left.jsp"%>
<!--aside nav  -->
<section class="rt_wrap content mCustomScrollbar">
 <div class="rt_content">
<form id="upd" method="post"  >
<input type="hidden" name="id" value="${productinfo.id}" />
 	<section class="rt_wrap content mCustomScrollbar" style="margin-top:10px;">
      <h2><strong style="color:grey;">分列内容布局</strong></h2>
      <ul class="ulColumn2">
      
       <li>
        <span class="item_name" style="width:120px;">产品名称：</span>
        <input type="text" name="productName" value="${productinfo.productName}" class="textbox textbox_295" datatype="s2-9"  errormsg="产品名称至少2个字符,最多9个字符！" />
       </li>
       
       <li>
        <span class="item_name" style="width:120px;">产品分类：</span>
        <select class="select" name="productType" datatype="*" errormsg="产品分类不能为空！">
	         <option value="">请选择</option>
	         <option value="1" <c:if test="${productinfo.productType==1}">selected</c:if>>基本产品</option>
	         <option value="2" <c:if test="${productinfo.productType==2}">selected</c:if>>高级产品</option>
	         <option value="3" <c:if test="${productinfo.productType==3}">selected</c:if>>定制产品</option>
        </select>
       </li>
       
       <li>
        <span class="item_name" style="width:120px;">所属城市：</span>
        <select class="select" name="cityName">
        	<c:forEach items="${list}" var="city">
        		<option value="${city.cityName}" <c:if test="${productinfo.cityName==city.cityName}">selected</c:if>>${city.cityName}</option>
        	</c:forEach>
        </select>
       </li>
      
       <li>
        <span class="item_name" style="width:120px;">产品描述：</span>
        <textarea name="productDes" class="textarea" style="width:200px;height:100px;" datatype="*" 
        		  errormsg="产品描述至少10个字符,最多100个字符！">${productinfo.productDes}</textarea>
       </li>
        
       <li>
       	<span class="item_name" style="width:120px;">产品详情页展示：</span>
       	 <textarea id="productDetail" style="width:100%;height:50px;"></textarea>
       </li>
     
       	<li>
        <span class="item_name" style="width:120px;">产品图片：</span>
        <label class="uploadImg">
         <input type="file" name="file" onchange="uploadImg('upd','showimg','productImgId','${ip}')" />
         <input type="hidden" name="productImageUrl" value="${productinfo.productImageUrl}" id="productImgId"  datatype="*"/>
         <span ><img id="showimg" src="http://${ip}/${productinfo.productImageUrl}"></span>
        </label>
       </li>
       
       <li>
        <span class="item_name" style="width:120px;">产品拓扑图：</span>
        <label class="uploadImg">
         <input type="file" name="file" onchange="uploadImg('upd','proshowimg','productTuopuId','${ip}')"/>
         <input type="hidden" name="productTuopuImage" value="${productinfo.productTuopuImage}" id="productTuopuId" />
         <span ><img id="proshowimg" src="http://${ip}/${productinfo.productTuopuImage}"></span>
        </label>
       </li>
 
       <li>
        <span class="item_name" style="width:120px;"></span>
        <input type="button" onclick="sub()" value="更新" class="link_btn"/>
       </li>
      </ul>
    </section>
</form>
</div>
</section>
</body>
<script>
var form1=$("#upd").Validform({
	tiptype:3
});

function uploadImg(formId,imgShowId,formFieldId,ip){
	js.upload(formId,imgShowId,formFieldId,ip);
}
//加载编辑器的容器
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl; 
// 加载编辑器的容器 
var ue = UE.getEditor('productDetail',{
	 autoHeightEnabled:false
	 ,initialFrameHeight:300
     ,initialFrameWidth:1024
});
UE.Editor.prototype.getActionUrl = function(action) {
    if (action == 'uploadimage' || action == 'uploadscrawl' || action == 'uploadimage') {
        return '${path}/fileUpLoad/upLoadUe.do';
    }else {
        return this._bkGetActionUrl.call(this, action);
    }
};
 //对编辑器的操作最好在编辑器ready之后再做
ue.ready(function() {
//设置编辑器的内容
ue.setContent('${productinfo.productDetailHtml}');
});
function sub(){
	var html=ue.getContent();
	var content=ue.getContentTxt();
	if(!ue.hasContents()){
		alert("请先填写内容!");
		return;
	}
	var options = {
			url :"${path}/productinfo/upProduct.do",
			type : "post",
			dataType : "json",
			data:{productDetailHtml:html,productDetail:content},
			success : function(data){
				if(data.status){
					alert(data.msg);
					window.location.href="${path}/productinfo/selectAllInfo.do";
				}else{
					alert(data.msg);
				}
			}
	};
	if(form1.check()){
		$("#upd").ajaxSubmit(options);
	}
}
</script>
</html>